<?php
namespace App\Http\Controllers;

/**
 * Swagger php 开发常用文档
 * https://www.sdk.cn/details/9pPQD6wqK09L8ozvNy
 *
 * @OA\Info(
 *      version="1.0.0",
 *      title="L5 OpenApi",
 *      description="L5 Swagger OpenApi description",
 *      @OA\Contact(
 *          email="darius@matulionis.lt"
 *      ),
 *     @OA\License(
 *         name="Apache 2.0",
 *         url="http://local-item-bank.com/"
 *     )
 * )
 *
 *  @OA\Server(
 *      url="http://local-dreamer.com/",
 *      description="L5 Swagger OpenApi dynamic host server",
 *     @OA\SecurityScheme(
 *     type="http",
 *     description="xxx sign",
 *     in="header",
 *     scheme="bearer"
 * )
 *  )
 *
 * @OA\SecurityScheme(
 *     type="oauth2",
 *     description="Use a global client_id / client_secret and your username / password combo to obtain a token",
 *     name="Password Based",
 *     in="header",
 *     scheme="https",
 *     securityScheme="Password Based",
 *     @OA\Flow(
 *         flow="password",
 *         authorizationUrl="/oauth/authorize",
 *         tokenUrl="/oauth/token",
 *         refreshUrl="/oauth/token/refresh",
 *         scopes={}
 *     )
 * )
 *
 * @OA\SecurityScheme(
 *     type="apiKey",
 *     description="全局添加API Token鉴权",
 *     name="authorization",
 *     in="header",
 *     securityScheme="Authorization-Bearer"
 * )
 *
 * @OA\ExternalDocumentation(
 *     description="Find out more about Swagger",
 *     url="http://swagger.io"
 * )
 *
 * header头参数，不带会报错
 * @OA\Parameter(
 *      name="Authorization",
 *      description="Bearer {access-token}",
 *      example="Bearer xxxx",
 *      required=true,
 *      in="header",
 *      @OA\Schema(type="string")
 * )
 *
 * @OA\Tag(
 *     name="Swagger文档例子",
 *     description="不会写文档，直接参考即可",
 *     @OA\ExternalDocumentation(
 *         description="Find out more about",
 *         url="http://swagger.io"
 *     )
 * )
 *
 */
class SwaggerController
{
    /**
     * @OA\Get(
     *     path="/hello/{id}",
     *     tags={"Swagger文档例子"},
     *      summary="get方法",
     *      description="描述",
     *      @OA\Parameter(
     *          name="id", description="123123", required=true, in="path", @OA\Schema(type="integer")
     *      ),
     *      @OA\Parameter(
     *          name="name", description="user name", required=true, in="path", @OA\Schema(type="strig")
     *      ),
     *     @OA\Response(
     *         response=200,
     *         description="SUCCESS/成功",
     *         @OA\MediaType(
     *             mediaType="application/json",
     *             @OA\Schema(
     *              @OA\Property(property="code", type="integer", format="int32", description="标识"),
     *              @OA\Property(property="msg", type="string", format="int32", description="描述"),
     *              @OA\Property(property="data",type="object",description="返回数据",
     *                 @OA\Property(property="no",type="string",description="版本号"),
     *                 @OA\Property(property="account",type="string",description="用户"),
     *                 @OA\Property(property="real_name",type="string",description="权限名称"),
     *             ),
     *         ),
     *         example={"code": 0,"msg": "success","data": {"no": "1.3","account": "admin","real_name": "god"}}
     *        )
     *     ),
     *      @OA\Response(response=400, description="Bad request"),
     *      @OA\Response(response=404, description="Resource Not Found"),
     *      security={
     *         {
     *             "oauth2_security_example": {"write:projects", "read:projects"}
     *         }
     *     },
     * )
     */
    public function get($id){}

    /**
     * @OA\Post(
     *     path="/hello/file-upload",
     *     tags={"Swagger文档例子"},
     *     summary="post上传方法",
     *     description="描述",
     *     @OA\RequestBody(
     *      @OA\MediaType(mediaType="application/x-www-form-urlencoded",
     *          @OA\Schema(
     *              type="object",
     *              required={"file", "id", "type"},
     *              @OA\Property(property="file", type="string", format="binary", description="user document file"),
     *              @OA\Property(property="id", type="integer", description="user id"),
     *              @OA\Property(property="type", type="string", enum={"verification_file","credit_card_file"})
     *          )
     *      )),
     *     @OA\Response(
     *          response=204,
     *          description="successful operation"
     *     )
     * )
     */
    public function post(){}

    /**
     * @OA\Put(
     *     path="/hello/{id}",
     *     tags={"Swagger文档例子"},
     *     summary="put方法",
     *     description="描述",
     *     @OA\RequestBody(
     *          required=true,
     *          @OA\JsonContent(
     *           required={"sales_name", "handle_fee", "commission", "status", "visible", "tiers"},
     *           @OA\Property(property="sales_name", type="string", description="sales name"),
     *           @OA\Property(property="handle_fee", type="number", format="float", description="handle fee", example="15.00"),
     *           @OA\Property(property="status", type="integer", enum={1, 0}),
     *           @OA\Property(property="charge_full_domestic", type="integer", description="charge full domestic"),
     *           @OA\Property(property="default", type="string", enum={1, 0}),
     *           @OA\Property(property="tiers", type="array", description="tiers",
     *              @OA\Items(
     *                  @OA\Property(property="type", type="string", enum={"flat", "basic", "subtract", "platform"}),
     *                  @OA\Property(property="from", type="integer", description="from", example="0")
     *              )
     *          ),
     *          )
     *      ),
     *     @OA\Parameter(
     *          name="id", in="path", description="member id", required=true, @OA\Schema(type="integer")
     *      ),
     *     @OA\Response(
     *          response="204",
     *          description="successful operation"
     *      )
     * )
     */
    public function put($id){}

    /**
     * @OA\Patch(
     *     path="/hello/{id}",
     *     tags={"Swagger文档例子"},
     *     summary="patch方法",
     *     description="描述",
     *     @OA\RequestBody(
     *          required=true,
     *          @OA\JsonContent(
     *              @OA\Property(property="name", type="string", description="user name"),
     *              @OA\Property(property="display_currency", type="string", enum={"USD","JPY"})
     *          )
     *      ),
     *     @OA\Parameter(
     *          name="id", in="path", description="member id", required=true, @OA\Schema(type="integer")
     *      ),
     *     @OA\Response(
     *          response=204,
     *          description="successful operation"
     *     )
     * )
     */
    public function patch($id){}

    /**
     * @OA\Delete(
     *     path="/hello/{id}",
     *     tags={"Swagger文档例子"},
     *     summary="delete方法",
     *     description="描述",
     *     @OA\Parameter(
     *      name="id", in="path", description="member id", required=true, @OA\Schema(type="integer"),
     *     ),
     *     @OA\Response(
     *          response=204,
     *          description="successful operation"
     *     )
     * )
     */
    public function delete($id){}

}
